﻿using Core.Framework;
using HandlerContextOptions;
using System.Threading.Tasks;
using UserCenter.Interfaces;

namespace UserCenter.Implements
{
    public class Notify : INotify
    {
        public Task<NotifyMessageResult> Error(NotifyMessageRequset requset)
        {
            return Task.FromResult(new NotifyMessageResult
            {
                IsSuccessful = EmailUtils.Send(requset.ToEmail, "[Error] " + requset.Title, requset.Content)
            });
        }

        public Task<NotifyMessageResult> Info(NotifyMessageRequset requset)
        {
            return Task.FromResult(new NotifyMessageResult
            {
                IsSuccessful = EmailUtils.Send(requset.ToEmail, "[Info] " + requset.Title, requset.Content)
            });
        }

        public Task<NotifyMessageResult> Warning(NotifyMessageRequset requset)
        {
            return Task.FromResult(new NotifyMessageResult
            {
                IsSuccessful = EmailUtils.Send(requset.ToEmail, "[Warning] " + requset.Title, requset.Content)
            });
        }
    }
}
